package com.example.ymm.modules1.service.impl.ms;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.ymm.base.BaseServiceImpl;
import com.example.ymm.modules1.entity.my.ms.PmcQueLiao;
import com.example.ymm.modules1.mapper.my.ms.PmcQueLiaoMapper;
import com.example.ymm.modules1.service.ms.PmcQueLiaoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@DS("slave2")
@DSTransactional
public class PmcQueLiaoServiceImpl extends BaseServiceImpl<PmcQueLiaoMapper, PmcQueLiao> implements PmcQueLiaoService {


    @Override
    public PmcQueLiao getByBuMenNameAndBiaoShiHao(String buMenName, String biaoShiHao) {
        LambdaQueryWrapper<PmcQueLiao> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PmcQueLiao::getBuMenName, buMenName);
        queryWrapper.eq(PmcQueLiao::getBiaoShiHao, biaoShiHao);
        List<PmcQueLiao> pmcQueLiaos = baseMapper.selectList(queryWrapper);
        if (pmcQueLiaos.size() > 0) {
            return pmcQueLiaos.get(0);
        }
        return null;
    }
}
